//
//  ZBMainPulicAPI.m
//  ZBMainFramework
//
//  Created by apple on 2018/10/24.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "ZB_MainPulicAPI.h"
#import "ZB_Tabbar.h"

@implementation ZB_MainPulicAPI
+ (ZB_TabBarViewController *)rootTabBarCcontroller
{
    [self restRootTabBarCcontroller];
    ZB_TabBarViewController *tabbarVC = [ZB_TabBarViewController shareInstance];
    tabbarVC.baseTabbar = [[ZB_Tabbar alloc]init];
    return tabbarVC;
}

+ (void)restRootTabBarCcontroller
{
    [ZB_TabBarViewController restshareInstance];
}
+ (void)addChildVC: (UIViewController *)vc normalImageName: (NSString *)normalImageName selectedImageName:(NSString *)selectedImageName  title:(NSString *)title isRequiredNavController: (BOOL)isRequired
{
    UIViewController *resultVC = vc;
    if(isRequired){
        resultVC = [[ZB_NavigationViewController alloc]initWithRootViewController:vc];
    }
    [[ZB_TabBarViewController shareInstance] addChildVC:resultVC normalImageName:normalImageName selectedImageName:selectedImageName title:title isRequiredNavController:isRequired];
}

/**
 获取当前跟控制器
 */
+ (ZB_TabBarViewController *)getCurrentRootTabBarCcontroller
{
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    ZB_TabBarViewController *rootVC = (ZB_TabBarViewController *)appDelegate.window.rootViewController;
    return rootVC;
}
@end
